<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="org.jbpm.graph.def.*" %>
<%@ page import="org.jbpm.graph.exe.*" %>
<%@ page import="org.jbpm.db.*" %>
<%@ page import="org.jbpm.*" %>
<%@ page import="com.gzgi.workflow.jbpm.model.*" %>
<%@ page import="com.gzgi.workflow.jbpm.context.*" %>
<%@ page import="com.gzgi.workflow.jbpm.service.*" %>
<%@ page import="com.gzgi.workflow.jbpm.datafield.*" %>
<%@ page import="com.gzgi.workflow.jbpm.container.*" %>
<%@ page import="com.gzgi.framework.util.*" %>
<%@ page import="org.apache.commons.lang.*" %>
<%@ include file="/pages/system/checkAdmin.jsp"%>
<%
        //http://localhost:8080/jbpm/jbpm/task.do?method=task&processInstanceId=328&actionType=running
       //http://localhost:8080/jbpm/pages/test/jbpm/process_start.jsp?processName=ExtensionProcess
	   //http://localhost:8080/jbpm/pages/test/jbpm/task_finish.jsp

        String rowId = request.getParameter("rowId");
		String actorId = request.getParameter("actorId");
		String processName = request.getParameter("processName");
      
		if(processName != null){
			 if(rowId == null){
			    rowId = "1";
			}
			if(actorId == null){
				actorId = "joy";
			}

			Collection datafields = new ArrayList();
			ProcessContext ctx = new ProcessContext();
			ctx.setRowId(rowId);
			ctx.setActorId(actorId);
			ctx.setTitle("单据编号："+rowId);
			ctx.setProcessName(processName);

			DataField datafield = new DataField();
		    datafield.setName("tableName");
            datafield.setValue("SYS_RICH_TEXT");
			datafields.add(datafield);
			ctx.setDataFields(datafields);
			
			try {
				String processInstanceId = ProcessContainer.getContainer().startProcess(ctx);
				if(processInstanceId != null){
					out.println(processInstanceId);
				}
			}catch (Exception ex) {
				ex.printStackTrace();
				throw new org.jbpm.JbpmException(ex);
			} 
		}
%>
